package 复习.面试TOP101.二分查找和排序;

public class 寻找峰值 {
        public int findPeakElement (int[] nums) {
            // write code here
            int left = 0;
            int right = nums.length - 1;
            while (left <= right){
                int index = left + ((right - left) >> 1);
                if(nums[index] > nums[index + 1]){
                    right = index;
                }else{
                    left = index + 1;
                }
            }
            return nums[right];
        }
}
